package club.xyes.zkh.ecommerce.dao.mapper;

import club.xyes.zkh.ecommerce.commons.entity.ShopMembershipLevel;
import club.xyes.zkh.ecommerce.dao.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Create by 郭文梁 2019/4/18 0018 14:23
 * ShopMembershipLevelMapper
 * 商铺会员等级定义相关数据库访问对象
 *
 * @author 郭文梁
 * @data 2019/4/18 0018
 */
public interface ShopMembershipLevelMapper extends BaseMapper<ShopMembershipLevel> {
    /**
     * 查询某商户的会员等级定义
     *
     * @param shopId 商铺ID
     * @return 等级定义
     */
    List<ShopMembershipLevel> selectByShopId(@Param("shopId") Integer shopId);

    /**
     * 获取指定条件在商铺等级中的最高等级
     *
     * @param shopId 商铺ID
     * @param fee    总消费金额
     * @param times  总消费次数
     * @return 等级定义
     */
    List<ShopMembershipLevel> highestLevelOfMatching(@Param("shopId") Integer shopId,
                                               @Param("fee") int fee,
                                               @Param("times") int times);
}
